import vue from '@vitejs/plugin-vue'
import styleImport from 'vite-plugin-style-import'

/**
 * @type {import('vite').UserConfig}
 */
export default {
  plugins: [
    vue(),
    styleImport({
      libs: [{
        libraryName: 'element-plus',
        esModule: true,
        ensureStyleFile: true,
        resolveStyle: (name) => {
          name = name.slice(3)
          return `element-plus/packages/theme-chalk/src/${name}.scss`;
        },
        resolveComponent: (name) => {
          return `element-plus/lib/${name}`;
        },
      },{
        libraryName: '@varlet/ui',
        esModule: true,
        resolveStyle: name => `@varlet/ui/es/${name}/style/index`,
      }]
    })
  ]
}
